<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :span="6" :sm="6">
            <a-form-item label="初审分组">
              <a-select v-model="cxj_jscs_fz_id" placeholder="请选择初审分组" @change="handleSelectFz">
                <a-select-option v-for="item in xszjfzData" :key="item.id" :value="item.cxj_jscs_fz_id">
                  {{ item.jscs_fz_mc }}
                </a-select-option>
              </a-select>
            </a-form-item>
          </a-col>
          <a-col :span="12" :sm="12">
            <div class="tjdata">
              <span>总数量：<span class="count">{{ reviewStatistics.sum }}</span></span>
              <span>已评分：<span class="count">{{ reviewStatistics.ypf }}</span></span>
              <span>未评分：<span class="count">{{ reviewStatistics.wpf }}</span></span>
              <span>评分状态: <span class="count">{{ reviewStatistics.pfzt == 0 ? '未提交' : reviewStatistics.pfzt == 1 ? '已提交' : ''}}</span></span>
            </div>
          </a-col>
          <a-col :span="6" :sm="6">
            <a-button type="primary" style="margin: 0px;"
              :disabled="reviewStatistics.pfzt == 0 ? false : reviewStatistics.pfzt == 1 ? true : ''"
              @click="submitQrode(reviewStatistics)">签名并提交</a-button>
            <a-button type="primary" style="margin: 0px 0 0 10px;" :disabled="reviewStatistics.pfzt == 0"
              @click="ratingPreview(1)">评分预览</a-button>
          </a-col>
        </a-row>
      </a-form>
      <p style="color: #ff0000;font-size: 16px;">该组成果全部评审完成后，点击"全部提交"完成评分，提交后不可修改。</p>
    </div>
    <!-- 查询区域-END -->
    <!-- 操作按钮区域 高级查询区域-->
    <div class="table-operator" style="display: flex; align-items: center;justify-content: space-between;"></div>
    <!-- table区域-begin -->
    <div>
      <h2 style="text-align:center;font-size: 20px;">
        {{ new Date().getFullYear() }}年度电力创新奖职工初审表
        <a-button type="primary" style="margin: 0px;" @click="downloadFile">初审表下载</a-button>
      </h2>
      <!-- tableLayout="auto" -->
      <a-table ref="table" size="middle" :scroll="{ x: 1100 }" bordered rowKey="cxj_xmbh" :columns="columns"
        :dataSource="dataSource" :pagination="ipagination" :loading="loading" class="j-table-force-nowrap"
        @change="handleTableChange">
        <template v-for="col in ['jscs_cxx', 'jscs_xjx', 'jscs_jjxy', 'jscs_ssxg', 'jscs_tgjz']" :slot="col"
          slot-scope="text, record">
          <div :key="col">
            <a-popover placement="top" v-if="record.editable">
              <template slot="content">
                <div v-if="col == 'jscs_cxx'">
                  <p>有根本性创新，16-20分</p>
                  <p>有一定创新，10-15分</p>
                  <p>原有技术改良，1-9分</p>
                </div>
                <div v-else-if="col == 'jscs_xjx'">
                  <p>技术水平领先，16-20分</p>
                  <p>技术水平先进，10-15分</p>
                  <p>技术水平一般，1-9分</p>
                </div>
                <div v-else-if="col == 'jscs_jjxy'">
                  <p>在行业可全面推广，16-20分</p>
                  <p>在行业可部分推广，10-15分</p>
                  <p>在行业特定情况下局部推广，1-9分</p>
                </div>
                <div v-else-if="col == 'jscs_ssxg'">
                  <p>经济效益和社会价值重大，9-10分</p>
                  <p>经济效益和社会价值较大，6-8分</p>
                  <p>有一定的经济效益和社会价值，1-5分</p>
                </div>
                <div v-else-if="col == 'jscs_tgjz'">
                  <p>项目实施后，问题得到根本解决，25-30分</p>
                  <p>项目实施后，问题得到基本解决，16-24分</p>
                  <p>项目实施后，问题得到部分解决，1-15分</p>
                </div>
              </template>
              <a-input type="number" style="margin: -5px 0" :value="text"
                @change="e => handleChange(e.target.value, record.key, col)" />
            </a-popover>
            <template v-else>
              {{ text }}
            </template>
          </div>
        </template>
        <template slot="jscs_pingjiayj" slot-scope="text, record">
          <div key="jscs_pingjiayj">
            <a-textarea :value="text" v-if="record.editable" placeholder="请填写评审意见"
              @change="e => handleChange(e.target.value, record.key, 'jscs_pingjiayj')"
              @click="e => handleOpinion(e.target.value, record.key, record.cxj_cxj_id, 'jscs_pingjiayj')"
              :auto-size="{ minRows: 1, maxRows: 5 }" />
            <template v-else>
              <a-popover title="" placement="bottom" arrow-point-at-center>
                <template slot="content">
                  <p style="max-width:300px; word-break: break-all;">{{ text }}</p>
                </template>
                <span class="sl-span">{{ text }}</span>
              </a-popover>
            </template>
          </div>
        </template>
        <template slot="jscs_sfhb" slot-scope="text, record">
          <div key="jscs_sfhb">
            <a-radio-group default-value="N" v-model="record.jscs_sfhb">
              <a-radio value="Y" :disabled="!record.editable">是</a-radio>
              <a-radio value="N" :disabled="!record.editable">否</a-radio>
            </a-radio-group>
          </div>
        </template>
        <span slot="cgzlAction" slot-scope="text, record">
          <a @click="handlePreview(record)">查看</a>
        </span>
        <span slot="jscs_zongfen" slot-scope="text, record">
          <span>{{ record.jscs_zongfen }}</span>
        </span>
        <template slot="action" slot-scope="text, record">
          <div class="editable-row-operations">
            <span v-if="!record.editable">
              <a v-if="record.jscs_zt == 1" disabled>评分</a>
              <a v-else :disabled="editingKey !== '' ? true : false" @click="() => edit(record.key)">评分</a>
            </span>
            <!-- <a-divider type="vertical" /> -->
            <span v-else>
              <a @click="() => save(record.key, record)">保存</a>
              <a-popconfirm title="真的放弃编辑吗?" @confirm="() => cancel(record.key)">
                <a>取消</a>
              </a-popconfirm>
            </span>
          </div>
        </template>
      </a-table>
    </div>
    <cxj-jscs-pf-js-modal ref="modalForm" @ok="modalFormOk"></cxj-jscs-pf-js-modal>
    <!-- 二维码 -->
    <a-modal
      title="请用手机扫二维码签名"
      centered
      width="400px"
      height="400px"
      :visible="qrcodeVisible"
      :footer="null"
      @cancel="handleCancel()">
      <vue-qr :text="imgQrUrl" :size="360" :margin="0"></vue-qr>
    </a-modal>
    <!-- pdf -->
    <view-pdf :params="pafParams" :showPdf="showpdf" @reset="getQrUrl" @sure="handleSure" :pafBtn="pafBtn"></view-pdf>
    <OpinionModal :showFlag="opinionFlag" :opinion="opinionValue" @updateOpinion="updateOpinion" />
  </a-card>
</template>

<script>
import qs from 'qs';
import Vue from 'vue'
import VueQr from 'vue-qr'
import CxjJscsPfJsModal from './modules/CxjJscsPfJsModal'
import viewPdf from '@/views/cxj/viewPdf'
import OpinionModal from './OpinionModal/index.vue'
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { getAction } from '../../api/manage'
import { USER_INFO, ACCESS_TOKEN } from "@/store/mutation-types"
import {
  // 初审项目评分表-职工类-查二维码签名状态
  cxjcsCheckQrcodeZg,
  // 初审项目评分表-职工类-查二维码
  cxjcsSubmitQrcodeZg,
  // 初审项目评分表-职工类-获取分组项目
  cxjcsGetFzxmListByFzidZg,
  // 初审项目评分表-职工类-评分保存或修改
  cxjcsSavePfZg,
  // 初审项目评分表-职工类-评分提交
  cxjcsSubmitPfZg,
  // 职工初审评分表-评分统计-专家
  zgcsPfTjZj
} from "@/api/api";
import {
  // 职工初审评分表-导出
  jscsPfExport
} from "@/api/manage"
export default {
  name: 'CxjJscsPfZg',
  mixins: [mixinDevice],
  components: {
    CxjJscsPfJsModal,
    VueQr,
    viewPdf,
    OpinionModal
  },
  data() {
    return {
      description: '初审项目评分表-职工类-获取分组项目',
      loading: false,
      showpdf: false,
      pafBtn: false,
      opinionFlag: false,
      qrcodeVisible: false,
      opinionKey: '',
      opinionValue: '',
      cxj_jscs_fz_id: '',
      reviewStatistics: '',
      fzid: '',
      editingKey: '',
      fileStatus: '',
      imgQrUrl: '',
      cxj_cxj_id: '',
      pafParams: {},
      queryParam: {},
      dictOptions: {},
      selectedRowKeys: [],
      selectionRows: [],
      cacheData: [],
      superFieldList: [],
      dataSource: [],
      xszjfzData: [],
      isorter: {
        column: 'createTime',
        order: 'desc',
      },
      url: {
        list: "/cxj/cxjJscsPfZg/list",
        delete: "/cxj/cxjJscsPfZg/delete",
        deleteBatch: "/cxj/cxjJscsPfZg/deleteBatch",
        exportXlsUrl: "/cxj/cxjJscsPfZg/exportXls",
        importExcelUrl: "cxj/cxjJscsPfJs/importExcel",
        cxjCsGetZjFz: '/cxj/cxjJscsFzZj/cxjCsGetZjFz'
      },
      ipagination: {
        current: 1,
        pageSize: 10,
        pageSizeOptions: ['10', '20', '100'],
        showTotal: (total, range) => {
          return range[0] + "-" + range[1] + " 共" + total + "条"
        },
        showQuickJumper: true,
        showSizeChanger: true,
        total: 0
      },
      // 表头
      columns: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          width: '5%',
          customCell: () => {
            return {
              style: {
                'min-width': '40px',
              },
            };
          },
          align: "center",
          // fixed: 'left',
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          }
        },
        {
          title: '成果编号',
          align: "center",
          dataIndex: 'cxj_xmbh',
          width: '10%',
          customCell: () => {
            return {
              style: {
                'min-width': '80px',
              },
            };
          },
        },
        {
          title: '成果名称',
          dataIndex: 'cxj_mc_zw',
          width: '15%',
          customCell: () => {
            return {
              style: {
                'min-width': '130px',
              },
            };
          },
        },
        {
          title: '成果资料',
          align: "center",
          dataIndex: 'cgzlAction',
          width: '5%',
          customCell: () => {
            return {
              style: {
                'min-width': '80px',
              },
            };
          },
          scopedSlots: { customRender: 'cgzlAction' }
        },
        {
          title: '审查意见',
          // width: 800,
          align: 'center',
          children: [
            {
              title: '技术创新性',
              align: "center",
              width: '7%',
              customCell: () => {
                return {
                  style: {
                    'min-width': '100px',
                  },
                };
              },
              children: [{
                title: "20分",
                align: "center",
                width: '7%',
                customCell: () => {
                  return {
                    style: {
                      'min-width': '100px',
                    },
                  };
                },
                dataIndex: "jscs_cxx",
                scopedSlots: { customRender: 'jscs_cxx' }
              }]
            },
            {
              title: '技术先进性',
              align: "center",
              width: '7%',
              customCell: () => {
                return {
                  style: {
                    'min-width': '100px',
                  },
                };
              },
              children: [{
                title: "20分",
                align: "center",
                width: '7%',
                customCell: () => {
                  return {
                    style: {
                      'min-width': '100px',
                    },
                  };
                },
                dataIndex: "jscs_xjx",
                scopedSlots: { customRender: 'jscs_xjx' }
              }]
            },
            {
              title: '使用范围',
              align: "center",
              width: '7%',
              customCell: () => {
                return {
                  style: {
                    'min-width': '100px',
                  },
                };
              },
              children: [{
                title: "20分",
                align: "center",
                width: '7%',
                customCell: () => {
                  return {
                    style: {
                      'min-width': '100px',
                    },
                  };
                },
                dataIndex: "jscs_jjxy",
                scopedSlots: { customRender: 'jscs_jjxy' }
              }]
            },
            {
              title: '经济效益',
              width: '7%',
              customCell: () => {
                return {
                  style: {
                    'min-width': '100px',
                  },
                };
              },
              children: [{
                title: "10分",
                align: "center",
                width: '7%',
                customCell: () => {
                  return {
                    style: {
                      'min-width': '100px',
                    },
                  };
                },
                dataIndex: "jscs_ssxg",
                scopedSlots: { customRender: 'jscs_ssxg' }
              }]
            },
            {
              title: '实施效果',
              width: '7%',
              customCell: () => {
                return {
                  style: {
                    'min-width': '100px',
                  },
                };
              },
              children: [{
                title: "30分",
                align: "center",
                width: '7%',
                customCell: () => {
                  return {
                    style: {
                      'min-width': '100px',
                    },
                  };
                },
                dataIndex: "jscs_tgjz",
                scopedSlots: { customRender: 'jscs_tgjz' }
              }]
            },
            {
              title: '合计',
              align: "center",
              width: '8%',
              customCell: () => {
                return {
                  style: {
                    'min-width': '60px',
                  },
                };
              },
              dataIndex: 'jscs_zongfen',
              scopedSlots: { customRender: 'jscs_zongfen' },
              sorter: (a, b) => b.total_score - a.total_score,
            },
            {
              title: '评审意见',
              dataIndex: 'jscs_pingjiayj',
              scopedSlots: { customRender: 'jscs_pingjiayj' }
            },
            {
              title: '是否回避',
              dataIndex: 'jscs_sfhb',
              scopedSlots: { customRender: 'jscs_sfhb' }
            }
          ]
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: "center",
          fixed: "right",
          width: 110,
          scopedSlots: { customRender: 'action' }
        }
      ],
    }
  },
  created() {
    this.$set(this.dictOptions, 'isValid', [{ text: '是', value: 'Y' }, { text: '否', value: 'N' }])
    this.getSuperFieldList();
    this.fetchCxjCsGetZjFz();
  },
  watch: {
    dataSource() {
      this.updateDataSource();
    }
  },
  methods: {
    handleOpinion(value, key, id, column) {
      this.opinionKey = id
      this.opinionValue = value
      this.opinionFlag = !this.opinionFlag
    },
    updateOpinion(value) {
      this.opinionFlag = !this.opinionFlag
      this.dataSource.forEach(item => {
        if (item.cxj_cxj_id == this.opinionKey) {
          item.jscs_pingjiayj = value
        }
      })
    },
    handleSure() {
      let user = Vue.ls.get(USER_INFO);
      let formData = new FormData();
      formData.append('fzid', this.fzid)
      formData.append('zjid', user.id)
      const that = this
      cxjcsSubmitPfZg(formData).then(res => {
        if (res.code == 200) {
          // 签名成功后获取评分状态，保证未提交变成已提交
          this.getzgcsPfTjZj()
          that.$message.success(res.message);
          that.fetchCxjCsGetZjFz();
        } else {
          that.$message.warning(res.message);
          that.fetchCxjCsGetZjFz();
        }
      })
    },
    handleCancel() {
      clearInterval(this.qrTimer)
      this.qrcodeVisible = false;
    },
    // 评分预览
    ratingPreview(flag) {
      this.pafBtn = flag == 1 ? false : true
      let user = Vue.ls.get(USER_INFO);
      this.pafParams = {
        fzid: this.fzid,
        zjid: user.id
      }
      this.showpdf = !this.showpdf
    },
    // 查询签名状态
    checkSignStatus(params) {
      clearInterval(this.qrTimer)
      this.qrTimer = setInterval(() => {
        cxjcsCheckQrcodeZg(params).then(res => {
          if (res.result) {
            clearInterval(this.qrTimer)
            this.qrcodeVisible = false
            setTimeout(() => {
              this.ratingPreview(2)
            }, 1000)
            this.$message.success("签名成功！")
          }
        }).catch(err => {
          this.$message.error("查询签名状态失败！")
        })
      }, 2000)
    },
    submitQrode(record) {
      if (record.ypf == record.sum) {
        this.getQrUrl()
      } else {
        this.$message.warning("还未完成评分，无法提交！")
      }
    },
    // 查询二维码地址
    getQrUrl() {
      let user = Vue.ls.get(USER_INFO);
      let that = this
      let formData = new FormData();
      formData.append('fzid', this.fzid)
      formData.append('zjid', user.id)
      cxjcsSubmitQrcodeZg(formData).then(res => {
        if (res.code === 200) {
          this.imgQrUrl = `${window.location.origin}${res.result}&path=cxjJscsPfZg`
          this.qrcodeVisible = true
          this.checkSignStatus({
            fzid: that.fzid,
            zjid: user.id
          })
        } else {
          this.$message.error(res.message)
        }
      }).catch(err => {
        this.$message.error("查询二维码失败！")
      })
    },
    updateDataSource() {
      this.dataSource.map(item => {
        item.jscs_zongfen = Number(item.jscs_cxx) + Number(item.jscs_jjxy) + Number(item.jscs_ssxg) + Number(item.jscs_tgjz) + Number(item.jscs_xjx)
      })
    },
    // 切换分组
    handleSelectFz(value) {
      this.fzid = value;
      this.getzgcsPfTjZj();
      this.loadData(1);
    },
    // 获取职工初审评分表-评分统计
    getzgcsPfTjZj() {
      let formData = new FormData();
      formData.append('fzid', this.fzid)
      zgcsPfTjZj(formData).then(res => {
        if (res.code == 200) {
          this.reviewStatistics = res.result;
        } else {
          this.$message.warning(res.message)
        }
      })
    },
    // 全部提交 -- 因为加二维码签名需求，此部分提交暂时废用
    submitAll(record) {
      let that = this;
      if (record.ypf == record.sum) {
        let user = Vue.ls.get(USER_INFO);
        let formData = new FormData();
        formData.append('fzid', this.fzid)
        formData.append('zjid', user.id)
        this.$confirm({
          title: '确定要全部提交吗?',
          okText: '确定',
          cancelText: '取消',
          onOk() {
            cxjcsSubmitPfZg(formData).then(res => {
              if (res.code == 200) {
                that.$message.success(res.message);
                that.fetchCxjCsGetZjFz();
              } else {
                that.$message.warning(res.message);
                that.fetchCxjCsGetZjFz();
              }
            })
          },
          onCancel() {
            console.log('Cancel');
          },
        });
      } else {
        this.$message.warning("还未完成评分，无法提交！")
      }
    },
    resetSearchForm() {
      this.fetchCxjCsGetZjFz();
    },
    // 获取分组列表【用于职工类-获取分组项目列表参数fzid】
    fetchCxjCsGetZjFz() {
      let user = Vue.ls.get(USER_INFO);
      getAction(this.url.cxjCsGetZjFz, { sysZjId: user.id, flbh: 61 }).then(res => {
        if (res.success) {
          if (res.result.length) {
            this.xszjfzData = res.result;
            this.fzid = res.result[0].cxj_jscs_fz_id;
            this.cxj_jscs_fz_id = res.result[0].cxj_jscs_fz_id;
          }
          this.loadData();
          this.getzgcsPfTjZj();
        }
      })
    },
    // 初审表下载
    downloadFile() {
      console.log('初审表下载')
      let data = {
        fzid: this.cxj_jscs_fz_id
      }
      jscsPfExport(data).then(res => {
        this.downfn('初审表下载', res);
      })
    },
    downfn(name, res) {
      const _res = res;
      let blob = new Blob([_res], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });
      let downloadElement = document.createElement("a");
      let href = window.URL.createObjectURL(blob); //创建下载的链接
      downloadElement.href = href;
      downloadElement.download = name; //下载后文件名
      document.body.appendChild(downloadElement);
      downloadElement.click(); //点击下载
      document.body.removeChild(downloadElement); //下载完成移除元素
      window.URL.revokeObjectURL(href); //释放掉blob对象
    },
    // 查看
    handlePreview(record) {
      console.log('查看', record.cxj_cxj_id)
      let token = Vue.ls.get(ACCESS_TOKEN);
      sessionStorage.setItem('token', token);
      let routeData = this.$router.resolve({
        path: '/shenbao/declare',
        query: {
          type: record.fl_id,
          cxj_cxj_id: record.cxj_cxj_id,
          isHead: 2,
          from: 'zj',
          xmztbh: record.xmztbh,
          cxj_xmbh: record.cxj_xmbh,
          cxj_mc_zw: record.cxj_mc_zw
        }
      });
      window.open(routeData.href, '_blank');
    },

    /* 对行内进行修改开始 */
    handleChange(value, key, column) {
      const newData = [...this.dataSource];
      const target = newData.filter(item => key === item.key)[0];
      // console.log('target',target)
      if (column == 'jscs_cxx' && value > 20) {
        value = 20;
      } else if (column == 'jscs_xjx' && value > 20) {
        value = 20;
      } else if (column == 'jscs_jjxy' && value > 20) {
        value = 20;
      } else if (column == 'jscs_ssxg' && value > 10) {
        value = 10;
      } else if (column == 'jscs_tgjz' && value > 30) {
        value = 30;
      }
      if (target) {
        target[column] = value;
        // console.log('target[column]',target[column])
        this.dataSource = newData;
        console.log('input', this.dataSource)
      }
    },
    edit(key) {
      const newData = [...this.dataSource];
      const target = newData.filter(item => key === item.key)[0];
      this.editingKey = key;
      if (target) {
        target.editable = true;
        this.dataSource = newData;
      }
    },
    save(key, record) {
      const newData = [...this.dataSource];
      const newCacheData = [...this.cacheData];
      const target = newData.filter(item => key === item.key)[0];
      const targetCache = newCacheData.filter(item => key === item.key)[0];
      if (target && targetCache) {
        delete target.editable;
        this.dataSource = newData;
        Object.assign(targetCache, target);
        this.cacheData = newCacheData;
      }
      this.editingKey = '';
      let formData = {
        jscsCxx: record.jscs_cxx,
        jscsJjxy: record.jscs_jjxy,
        jscsPingjiayj: record.jscs_pingjiayj,
        // 是否回避
        jscsSfhb: record.jscs_sfhb,
        jscsSsxg: record.jscs_ssxg,
        jscsTgjz: record.jscs_tgjz,
        jscsXjx: record.jscs_xjx,
        cxjCxjId: record.cxj_cxj_id,
        id: record.id,
        jscsZt: record.jscs_zt
      }
      cxjcsSavePfZg(formData).then(res => {
        if (res.code == 200) {
          this.$message.success(res.message);
          this.loadData();
          this.getzgcsPfTjZj();
        } else {
          this.$message.warning(res.message);
          this.loadData();
          this.getzgcsPfTjZj();
        }
      })

    },
    cancel(key) {
      const newData = [...this.dataSource];
      const target = newData.filter(item => key === item.key)[0];
      this.editingKey = '';
      if (target) {
        Object.assign(target, this.cacheData.filter(item => key === item.key)[0]);
        delete target.editable;
        this.dataSource = newData;
      }
    },
    /* 对行内进行修改结束 */

    /* 获取列表固定格式开始 */
    getQueryField() {
      //TODO 字段权限控制
      var str = "id,";
      this.columns.forEach(function (value) {
        str += "," + value.dataIndex;
      });
      return str;
    },
    // 获取分组项目
    loadData(arg) {
      if (arg === 1) {
        this.ipagination.current = 1;
      }
      this.loading = true;
      let user = Vue.ls.get(USER_INFO);
      let params = Object.assign(this.queryParam, this.isorter, this.filters)
      params.field = this.getQueryField();
      params.pageNo = this.ipagination.current;
      params.pageSize = this.ipagination.pageSize;
      params.fzid = this.fzid;
      params.zjid = this.zjid;
      cxjcsGetFzxmListByFzidZg(qs.stringify(params)).then(res => {
        if (res.success) {
          this.dataSource = res.result.records || res.result;
          this.dataSource.map((item, index) => {
            item.key = index;
            item.total_score = item.jscs_zongfen;
            if (!item.jscs_sfhb) {
              item.jscs_sfhb = "N";
            }
          })
          this.cacheData = this.dataSource;
          if (res.result.total) {
            this.ipagination.total = res.result.total;
          } else {
            this.ipagination.total = 0;
          }
        }
        if (res.code === 510) {
          this.$message.warning(res.message)
        }
        this.loading = false;
      })
    },
    onSelectChange(selectedRowKeys, selectionRows) {
      this.selectedRowKeys = selectedRowKeys;
      this.selectionRows = selectionRows;
    },
    onClearSelected() {
      this.selectedRowKeys = [];
      this.selectionRows = [];
    },
    modalFormOk() {
      // 新增/修改 成功时，重载列表
      this.loadData();
      //清空列表选中
      this.onClearSelected()
    },
    handleTableChange(pagination, filters, sorter) {
      if (Object.keys(sorter).length > 0) {
        if (this.editingKey) {
        } else {
          this.loadData();
        }
        this.isorter.column = sorter.field;
        this.isorter.order = "ascend" == sorter.order ? "asc" : "desc"
      } else {
        this.loadData();
      }
      this.ipagination = pagination;
    },
    /* 获取列表固定格式结束 */
    getSuperFieldList() {
      let fieldList = [];
      fieldList.push({ type: 'string', value: 'sysZjId', text: '专家ID', dictCode: '' })
      fieldList.push({ type: 'string', value: 'cxjCxjId', text: '成果ID', dictCode: '' })
      fieldList.push({ type: 'double', value: 'jscsCxx', text: '职工创新性', dictCode: '' })
      fieldList.push({ type: 'double', value: 'jscsXjx', text: '职工先进性', dictCode: '' })
      fieldList.push({ type: 'double', value: 'jscsSsxg', text: '实用化程度', dictCode: '' })
      fieldList.push({ type: 'double', value: 'jscsJjxy', text: '经济效益', dictCode: '' })
      fieldList.push({ type: 'double', value: 'jscsTgjz', text: '推动作用', dictCode: '' })
      fieldList.push({ type: 'string', value: 'jscsPingjiayj', text: '评审意见', dictCode: '' })
      fieldList.push({ type: 'double', value: 'jscsZongfen', text: '总分', dictCode: '' })
      fieldList.push({ type: 'string', value: 'jscsZt', text: '评分状态', dictCode: '' })
      fieldList.push({ type: 'string', value: 'shijian', text: '年度', dictCode: '' })
      fieldList.push({ type: 'string', value: 'bz1', text: '备注1', dictCode: '' })
      fieldList.push({ type: 'string', value: 'bz2', text: '备注2', dictCode: '' })
      fieldList.push({ type: 'string', value: 'bz3', text: '备注3', dictCode: '' })
      fieldList.push({ type: 'switch', value: 'isValid', text: '是否有效' })
      this.superFieldList = fieldList
    }
  }
}
</script>
<style scoped lang="less">
@import '~@assets/less/common.less';

/deep/ * {
  font-size: 14px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

/deep/.ant-table-tbody>tr>td {
  word-break: break-all;
  white-space: normal;
  word-wrap: break-word;
  font-size: 14px;
  padding: 6px 3px !important;
}

/deep/.ant-table-tbody>tr>td>div {
  font-size: 14px;
}

/deep/.ant-table-thead>tr>th {
  word-break: break-all;
  white-space: normal;
  word-wrap: break-word;
  text-align: center;
  font-size: 14px;
  padding: 5px 3px !important;
}

.editable-row-operations a {
  margin-right: 8px;
}

.tjdata {

  // margin-top: 20px;
  span {
    margin-right: 20px;
    line-height: 30px;
    font-size: 16px;
  }
}

.count {
  color: #ee9900;
  font-weight: 700;
  font-size: 16px;
}

/deep/.ant-table-tbody>tr>td:nth-child(10) {
  color: #ee9900 !important;
  font-weight: 700;
  font-size: 16px;
}

.editable-row-operations a {
  margin: 0px 2px;
}

.table-page-search-wrapper .anty-form-btn .ant-form-item {
  margin-bottom: 10px;
}

// 用于解决表格气泡框字数过多时，不居中显示的问题
.sl-span {
  width: auto;
  max-width: 100%;
  display: inline-block; //会根据内容适配宽度
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  vertical-align: top; //添加此属性不会引起错位
}
</style>
